using System;
using System.Collections.Generic;
using System.Linq;
using Sirenix.OdinInspector;
using Sirenix.Serialization;
using UnityEngine;
using YDExtendTool.Scripts;

namespace YDExtendTool
{
    public class TreeDataSetting : SerializedScriptableObject
    {
        [Tooltip("在Inspector中设置这个值没有意义!,这个值仅用来表示当前/上次打开的数据文件")] public string EditTreeDataPath;
        [LabelText("创建节点菜单"),OdinSerialize]public TreeDataMenuConfig Menu;
        public static TreeDataSetting Instance => UnityEngine.Resources.Load<TreeDataSetting>("TreeData/TreeSetting");
    }

    /// <summary>
    /// 用于配置编辑器右键菜单
    /// </summary>
    public abstract class TreeDataMenuConfig
    {
    }

    public class TreeDataMenuFolder:TreeDataMenuConfig
    {
        public string Name;
        public List<TreeDataMenuConfig> MenuConfigs = new List<TreeDataMenuConfig>();
    }
    

    public class TreeDataMenuFile : TreeDataMenuConfig
    {
        public string Name;
        [TypeSelectorSettings(FilterTypesFunction = nameof(TypeFilterBool))]
        public Type DataType;
        
        public bool TypeFilterBool(Type type)
        {
            return type.IsSubclassOf(typeof(TreeNodeBase)) && !type.IsInterface;
        }
    }
}




